home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / morse / bunn41ta / n4lta.asm < prev    next >
Assembly Source File  |  1994-09-02  |  3KB  |  152 lines

  1.  
  2. ;This is a very simple program
  3. ;to transmit a morse code
  4. ;message with a PIC 16C54
  5. ;microcontroller. The morse
  6. ;message is constructed by
  7. ;calling subroutines that
  8. ;sends dits,dahs, and spaces
  9. ;
  10.  
  11.  
  12.  
  13. ;START OF PROGRAM
  14.  
  15. ;Set the device type,osc type,WDT status
  16. ;and code protect status
  17.  
  18.  
  19.     DEVICE  PIC16C54,rc_OSC,WDT_OFF,PROTECT_OFF
  20.  
  21.  
  22.         RESET   start           ;vector to 
  23.                     ;here on 
  24.                     ;reset
  25.  
  26. Count0          equ     10h
  27. Count1          equ     11h             ;CW Speed 
  28.                     ;timing bytes
  29.                     ;labels
  30.  
  31.  
  32. Start           mov     !RA,#10000000b  ;set bit7 
  33.                     ;as an input
  34.                     ;bit for 
  35.                     ;future use
  36.         
  37.         call WDSPC              ;wait 1 word
  38.                     ;space and
  39.         CALL DAH                ;then send
  40.                     ;the message
  41.         CALL DIT                ;by calling
  42.                     ;the appropriate
  43.         CALL DIT                ;dits and
  44.         CALL LETSPC             ;dahs. The dits
  45.                     ;and dahs have
  46.         CALL DIT                ;have spacing
  47.                     ;built in
  48.  
  49.         CALL WDSPC              ;DE
  50.  
  51.         CALL DAH
  52.         
  53.         CALL DIT
  54.         CALL LETSPC             ;N
  55.  
  56.         CALL DIT
  57.         CALL Dah
  58.         CALL Dah
  59.         CALL Dah
  60.         CALL DAH
  61.         CALL LETSPC             ;1
  62.  
  63.         CALL DIT
  64.         CALL Dit
  65.         CALL Dah
  66.         CALL DIT
  67.         CALL LETSPC             ;F
  68.  
  69.         
  70.         CALL DAH
  71.         call dit
  72.         call dit
  73.         call dit
  74.         CALL LETSPC             ;B
  75.  
  76.         CALL WDSPC
  77.         CALL WDSPC
  78.         CALL WDSPC              ;WAIT
  79.                     ;for 3
  80.                     ;word spaces
  81.                     ;and jump
  82.         jmp start               ;to the 
  83.                     ;beginning
  84.                     ;to repeat
  85.                     ;the message
  86.  
  87. ;DITIME is a routine that
  88. ;generates a one dit timing
  89. ;delay
  90.  
  91.  
  92.  
  93. DITIME                                  
  94.         mov     Count1,#00100000b
  95. :Loop           djnz    Count0,:Loop
  96.         djnz    Count1,:Loop
  97.         ret
  98.  
  99. ;LETSPC generates a letter space
  100. ;delay
  101.  
  102.  
  103. LETSPC          call DITIME
  104.         call DITIME
  105.         call DITIME             ;wait 3 ditimes
  106.         ret
  107.  
  108. ;WDSPC generates a word space      
  109. ;delay
  110.  
  111. WDSPC           call DITIME
  112.         call DITIME
  113.         call DITIME
  114.         call DITIME
  115.         call DITIME
  116.         call DITIME
  117.         call DITIME             ;wait 7 ditimes
  118.         ret
  119.  
  120. ;DIT sends a dit and waits 1 
  121. ;morse space
  122.  
  123. DIT             or      RA,#00000011b   ;set bit0 and bit1
  124.                     ;on
  125.         call    DITIME
  126.  
  127.         and     RA,#00000000b   ;turn them off
  128.         
  129.         call    DITIME          ;wait 1 ditime
  130.         ret
  131.  
  132.  
  133. ;DAH sends a dah and waits one 
  134. ;morse space
  135.  
  136.  
  137. DAH             or      RA,#00000011b   ;Bits 1,0 on
  138.         call    DITIME
  139.         call    DITIME
  140.         call    DITIME          ;wait 3 dits
  141.         and     RA,#00000000b   ;turn off
  142.         
  143.         call    DITIME          ;wait 1 ditime
  144.         ret
  145.  
  146.  
  147.  
  148.  
  149. ;End of the program
  150. ;written by P Bunn, N4LTA
  151. ;
  152.